<?php
/*
 * Created on 2011-4-13
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */

require ('../Common.inc.php');
require(SERVER_ROOT_PATH.'/config/base.config.php');
require (SERVER_ROOT_PATH . '/lib/Framework.class.php');

new Framework();
$username=$_POST['username'];
$pwd=$_POST['pwd'];
$key=hash_hmac('sha1',$username.$pwd,'wxy');
$u=new User('w');

$flag=$u->insertUserByUsername($username,$pwd,$key);
$u->closeDB();
if(!$flag){
	$_SESSION['userexist']=true;
	header("Location:register.php");
	
}else{
	$_SESSION['userexist']='';
	$_SESSION['username']=$username;
	header("Location:showlist.php");
}
?>
